package com.mycjj.android.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.mycjj.android.R;
import com.mycjj.android.bean.Point_StoreArticleRowBean;

public class ServiceArticleDetailActivity extends BaseActivity {
	Point_StoreArticleRowBean row;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_service_article_detail);
		init();
	}
	
	private ImageView mHeaderLeftImageview;
	private Button mHeaderRightButton;
	private TextView mHeaderTitleTextView;
	private void initHeader(){
		mHeaderLeftImageview = (ImageView) findViewById(R.id.header_left_button);
		mHeaderLeftImageview.setImageResource(R.drawable.back);
		mHeaderRightButton = (Button) findViewById(R.id.header_right_button);
		mHeaderRightButton.setVisibility(View.GONE);
		mHeaderTitleTextView = (TextView) findViewById(R.id.header_title_textview);
		mHeaderTitleTextView.setText("提醒");
		mHeaderLeftImageview.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				ServiceArticleDetailActivity.this.finish();
			}
		});
	}
	
	private void init(){
		initHeader();
		initdata();
	}
	
	private void initdata()
	{
		row = (Point_StoreArticleRowBean) getIntent().getSerializableExtra("article");
		if(null == row)
		{
			this.finish();
			return;
		}
		
		TextView textView1 = (TextView)findViewById(R.id.textView1);
		TextView textView2 = (TextView)findViewById(R.id.textView2);
		TextView textView3 = (TextView)findViewById(R.id.textView3);
		WebView webView = (WebView)findViewById(R.id.webView);
		
		textView1.setText(row.getArticle_title());
		textView2.setText(row.getArticle_time());
		textView3.setText(row.getArticle_store());
//		webView.loadData(row.getArticle_content(), "text/html", "utf-8");
		webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);  //就是这句
		webView.getSettings().setLoadWithOverviewMode(true);
		webView.setBackgroundColor(0); 
		webView.loadDataWithBaseURL("",row.getArticle_content(), "text/html", "UTF-8","");
	}

}
